package com.tool_stdy.utils.guava;

import com.google.common.collect.HashBiMap;

public class BiMapTest {
	/**
	 * K V都不可重复
	 */
	public static void biMapTest(){
		HashBiMap<String, String> bi = HashBiMap.create();
		bi.put("zs", "1");
		bi.put("ls", "2");
		//bi.put("wangwu", "2"); value重复会报错
		bi.put("ls", "3");//key重复会把前面覆盖掉
		//根据value找key
		System.out.println(bi.get("ls"));
		System.out.println(bi.inverse().get("3"));
	}
	public static void main(String[] args) {
		biMapTest();
	}
}
